<?

include_once "accesscontrol.php";
include_once "index.php";
include_once "navigation.html";
	
$bdir="../banners/";


if (isset($submitok) && $_FILES[userfile][size] > '0')
{
   if (empty($burl))
   {
	echo "<center><span class=TNA>You left blank some of the required fields. </span></center>";
   }
	else
	{
		$NewB = time()."_".$_FILES[userfile][name];
	  copy($_FILES[userfile][tmp_name], "../banners/$NewB");	

	  $qbn = "select * from job_banners_t";
	  $rbn = mysql_query($qbn) or die (mysql_error());
	  $cbn = mysql_num_rows($rbn);

	  $nbn = $cbn + 1;

	  $q2 = "insert into job_banners_t (b_id, fn, burl, alt) values ('$nbn', '$NewB', '$burl', '$alt')";
	  $rq2 = mysql_query($q2) or die(mysql_error());
	

		$sb13 = "select count(bc) from job_banners_m";
		$r13 = mysql_query($sb13) or die(mysql_error());
		$ar13 = mysql_fetch_array($r13);

		if($ar13[0] == 0)
		{
			$ubi = "insert into job_banners_m (bc) values ('1') ";
			$rup = mysql_query($ubi) or die(mysql_error());
		}
		else
		{
			$ubi = "update job_banners_m set bc = '1' ";
			$rup = mysql_query($ubi) or die(mysql_error());
		}
	}

}

unset($submitok);
unset($userfile);
?>


<br>
<center>

<form method=post action="<?=$PHP_SELF?>" enctype="multipart/form-data">
<table class=BlackLink width=470>
<tr>
	<td align=right>URL to the banner target web site:</td>
	<td><input type=text size=36 name=burl value="http://"></td>
</tr>

<tr>
	<td align=right>Alt text:</td>
	<td><input type=text name=alt size=36 maxlength=255></td>
</tr>

<tr>
	<td align=right>Browse you local HDD:</td>
	<td><input type=file size=25 name="userfile"></td>
</tr>

<tr>
	<td></td>
	<td><input type=submit name="submitok"  value="Upload">
	</td>
</tr>
</table>
</form>
</center>


<? include_once('../footer.php'); ?>